package com.ht.activiti.cacheexception;

import org.apache.shiro.authz.UnauthenticatedException;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhangfc
 * @date 2021/11/4 9:52
 */
@ControllerAdvice
@RestController
public class NoPermissionException {
    @ExceptionHandler(UnauthorizedException.class)
    public String handleShiroException(Exception e){
        return "无权限";
    }
    @ExceptionHandler(UnauthenticatedException.class)
    public String AuthorizationException(Exception e){
        return "权限认证失败";
    }
}
